#include <stdio.h>
#include <stdlib.h>
#include <math.h>

void getRoot(int a,int b,int c,double result[4]){
    double delta = b*b-4*a*c;
    if (abs(delta-0)<10E-6)
        result[0]=result[1]=-b/2.0/a;
    else if (delta>0) {
        result[0] = (-b+sqrt(delta))/2.0/a;
        result[1] = (-b-sqrt(delta))/2.0/a;
    }
    else {
        result[1] = result[0] = -b/2.0/a;
        result[2] = sqrt(-delta)/2.0/a;
        result[3] = -sqrt(-delta)/2.0/a;
    }
}

int main(){
    // 求解方程
    int a,b,c;
    double result[4]={0};
    printf("ax^2+bx+c=0,input:");
    scanf("%d %d %d",&a,&b,&c);
    getRoot(a,b,c,result);
    if (result[0]==0) printf("error!!!\n");
    else if (result[3]==0) printf("x1=%lf\tx2=%lf\n",result[0],result[1]);
    else printf("x1=%lf+%lfi\tx2=%lf+%lfi\n",result[0],result[2],result[1],result[3]);
    return 0;
}